import { createSwitchNavigator, createAppContainer, createBottomTabNavigator, createStackNavigator, NavigationScreenProps, NavigationTabScreenOptions } from 'react-navigation'
import { Welcome, Sign, Home, My } from './src/page'
import PlanEdit from './src/page/plan/edit'
import PlanView from './src/page/plan/view'
import React from 'react'
import { Provider } from './src/components'
// import { DatePicker, List, Provider, Modal } from '@ant-design/react-native';

const HomeStackNavigator = createStackNavigator({
  Index: Home,
  PlanEdit: PlanEdit,
  PlanView: PlanView
},
{
  defaultNavigationOptions: {
    tabBarVisible: false
  },
  initialRouteName: 'Index'
})

HomeStackNavigator.navigationOptions = ({ navigation }: NavigationScreenProps): NavigationTabScreenOptions => {
  return {
    tabBarVisible: navigation.state.index === 0
  }
}

const App = createBottomTabNavigator({
  Home: HomeStackNavigator,
  My: My
})
const navigatorApp = createSwitchNavigator(
  {
    Welcome: Welcome,
    Sign: Sign,
    App: App
  },
  {
    initialRouteName: 'App'
  }
)
const AppContainer = createAppContainer(navigatorApp)
export default class Main extends React.Component {
  public render (): JSX.Element {
    return (
      <Provider>
        <AppContainer />
      </Provider>
    )
  }
}
